package net.mihome.app.bean;

import net.mihome.app.bean.net.ResponsePojo;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * Created by ZHAO on 2014/12/21 0021.
 * model
 *
 */
public class RepairRequire extends  MihomeBase{
    private int id;
    private int uid;
    private int company_id;
    private String imgs;
    private String update_at;
    private int status;
    private String create_at;
    private String mark;
    private String content;
    private String status_name;
    private String repaired_imgs;
    private int is_del;
    private int repairman_id;

    public static RepairRequire parse(Map map){
        RepairRequire repairRequire=new RepairRequire();
        repairRequire.setId(convertFromObj(map.get("id")));
        repairRequire.setUid(convertFromObj(map.get("uid")));
        repairRequire.setCompany_id(convertFromObj(map.get("company_id")));
        repairRequire.setImgs((String)map.get("imgs"));
        repairRequire.setUpdate_at((String)map.get("update_at"));
        repairRequire.setStatus(convertFromObj(map.get("status")));
        repairRequire.setCreate_at((String) map.get("create_at"));
        repairRequire.setMark((String) map.get("mark"));
        repairRequire.setContent((String) map.get("content"));
        repairRequire.setStatus_name((String) map.get("status_name"));
        repairRequire.setRepaired_imgs((String) map.get("repaired_imgs"));
        repairRequire.setIs_del(convertFromObj(map.get("is_del")));
//        repairRequire.setRepairman_id(convertFromObj(map.get("repairman_id")));
        return repairRequire;
    }

    public static List<RepairRequire> parserList(ResponsePojo<List<Map>> responsePojo){
        if(responsePojo==null||responsePojo.getData()==null){
            throw new NullPointerException("无返回数据");
        }else{
            List<RepairRequire> shopList=new ArrayList<>();
            List<Map> mapList=responsePojo.getData();
            Iterator<Map> iterator=mapList.iterator();
            while(iterator.hasNext()){
                Map map=iterator.next();
                RepairRequire repairRequire=parse(map);
                shopList.add(repairRequire);
            }
            return shopList;
        }
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public int getCompany_id() {
        return company_id;
    }

    public void setCompany_id(int company_id) {
        this.company_id = company_id;
    }

    public String getImgs() {
        return imgs;
    }

    public void setImgs(String imgs) {
        this.imgs = imgs;
    }

    public String getUpdate_at() {
        return update_at;
    }

    public void setUpdate_at(String update_at) {
        this.update_at = update_at;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getCreate_at() {
        return create_at;
    }

    public void setCreate_at(String create_at) {
        this.create_at = create_at;
    }

    public String getMark() {
        return mark;
    }

    public void setMark(String mark) {
        this.mark = mark;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getStatus_name() {
        return status_name;
    }

    public void setStatus_name(String status_name) {
        this.status_name = status_name;
    }

    public String getRepaired_imgs() {
        return repaired_imgs;
    }

    public void setRepaired_imgs(String repaired_imgs) {
        this.repaired_imgs = repaired_imgs;
    }

    public int getIs_del() {
        return is_del;
    }

    public void setIs_del(int is_del) {
        this.is_del = is_del;
    }

    public int getRepairman_id() {
        return repairman_id;
    }

    public void setRepairman_id(int repairman_id) {
        this.repairman_id = repairman_id;
    }
}
